//
//  DeepCopyStudentModel.swift
//  ArchitectGenerics
//
//  Created by 姚胜龙 on 2017/6/13.
//  Copyright © 2017年 姚胜龙. All rights reserved.
//

import UIKit

//深度拷贝的测试类 学生类
class DeepCopyStudentModel: DeepCopyProtocal {

    var name:String?
    var teachers:Array<TeacherModel2>?

    init(name:String, teachers:Array<TeacherModel2>) {
        self.name = name
        self.teachers = teachers
    }

    func deepClone() -> AnyObject? {
        var newArray = Array<TeacherModel2>()
        for teacher in self.teachers! {
            newArray.append(teacher.deepClone() as! TeacherModel2)
        }
        return DeepCopyStudentModel(name: self.name!, teachers: newArray)
    }
}
